package com.ds.common.exception;

/**
 * 系统异常
 *
 * @author fs
 */
public class SystemException extends RuntimeException {

    private ErrorEnum errorCode;

    public SystemException(ErrorEnum errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public SystemException(String message, ErrorEnum errorCode) {
        super(message);
        this.errorCode = errorCode;
    }

    public SystemException(String message, Throwable cause, ErrorEnum errorCode) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public SystemException(Throwable cause, ErrorEnum errorCode) {
        super(cause);
        this.errorCode = errorCode;
    }

    public SystemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, ErrorEnum errorCode) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.errorCode = errorCode;
    }

    public ErrorEnum getErrorEnum() {
        return errorCode;
    }

    public void setErrorEnum(ErrorEnum errorCode) {
        this.errorCode = errorCode;
    }
}
